/*
 Navicat Premium Data Transfer

 Source Server         : locaserver
 Source Server Type    : MariaDB
 Source Server Version : 100237
 Source Host           : 192.168.2.240:3306
 Source Schema         : sups

 Target Server Type    : MariaDB
 Target Server Version : 100237
 File Encoding         : 65001

 Date: 15/04/2021 16:26:25
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `role_name` varchar(15) NOT NULL COMMENT '角色名称',
  `role_status` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'True:启用 False:禁用',
  `role_desc` varchar(255) DEFAULT NULL COMMENT '角色描述',
  `create_time` datetime(6) NOT NULL DEFAULT current_timestamp(6) COMMENT '创建时间',
  `update_time` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色';

-- ----------------------------
-- Table structure for role_rule
-- ----------------------------
DROP TABLE IF EXISTS `role_rule`;
CREATE TABLE `role_rule` (
  `role_id` int(11) NOT NULL,
  `rule_id` int(11) NOT NULL,
  KEY `role_id` (`role_id`),
  KEY `rule_id` (`rule_id`),
  CONSTRAINT `role_rule_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE CASCADE,
  CONSTRAINT `role_rule_ibfk_2` FOREIGN KEY (`rule_id`) REFERENCES `rule` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for rule
-- ----------------------------
DROP TABLE IF EXISTS `rule`;
CREATE TABLE `rule` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `rule_name` varchar(15) NOT NULL COMMENT '权限名称',
  `parent_id` int(11) NOT NULL DEFAULT 0 COMMENT '父id',
  `scopes` varchar(255) NOT NULL COMMENT '权限范围标识',
  `rule_desc` varchar(255) DEFAULT NULL COMMENT '权限描述',
  `is_check` int(11) NOT NULL DEFAULT 1 COMMENT '权限状态 1权限 2必选权限',
  `is_menu` int(11) NOT NULL DEFAULT 2 COMMENT '是否为菜单 1菜单 2不是菜单',
  `create_time` datetime(6) NOT NULL DEFAULT current_timestamp(6) COMMENT '创建时间',
  `update_time` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `scopes` (`scopes`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COMMENT='系统权限';

-- ----------------------------
-- Records of rule
-- ----------------------------
BEGIN;
INSERT INTO `rule` VALUES (1, '用户管理', 0, 'admin', NULL, 1, 1, '2021-03-22 15:58:01.625728', '2021-03-22 15:58:01.625761');
INSERT INTO `rule` VALUES (2, '管理员', 1, 'admin_user', NULL, 1, 1, '2021-03-22 15:58:43.082897', '2021-03-22 16:00:01.151938');
INSERT INTO `rule` VALUES (3, '角色管理', 1, 'admin_role', NULL, 1, 1, '2021-03-22 15:59:22.813479', '2021-03-22 16:00:04.042416');
INSERT INTO `rule` VALUES (4, '用户添加', 2, 'admin_user_add', NULL, 1, 2, '2021-03-22 16:01:11.692877', '2021-03-22 16:01:11.692905');
INSERT INTO `rule` VALUES (5, '用户修改', 2, 'admin_user_update', NULL, 1, 2, '2021-03-22 16:01:31.104827', '2021-03-22 16:01:31.104854');
INSERT INTO `rule` VALUES (6, '用户删除', 2, 'admin_user_delete', NULL, 1, 2, '2021-03-22 16:01:50.027122', '2021-03-22 16:01:50.027150');
INSERT INTO `rule` VALUES (7, '角色添加', 3, 'admin_role_add', NULL, 1, 2, '2021-03-22 16:02:43.129700', '2021-03-22 16:10:12.049700');
INSERT INTO `rule` VALUES (8, '角色修改', 3, 'admin_role_update', NULL, 1, 2, '2021-03-22 16:08:42.692349', '2021-03-22 16:10:08.810322');
INSERT INTO `rule` VALUES (9, '角色删除', 3, 'admin_role_delete', NULL, 1, 2, '2021-03-22 16:09:44.303779', '2021-03-22 16:10:06.370963');
COMMIT;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(20) DEFAULT NULL COMMENT '用户名',
  `type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '用户类型 True:超级管理员 False:普通管理员',
  `password` varchar(255) DEFAULT NULL,
  `nickname` varchar(255) NOT NULL DEFAULT '阑羹阁兒' COMMENT '昵称',
  `u_phone` varchar(11) DEFAULT NULL COMMENT '手机号',
  `u_email` varchar(255) DEFAULT NULL COMMENT '邮箱',
  `full_name` varchar(255) DEFAULT NULL COMMENT '姓名',
  `u_status` int(11) NOT NULL DEFAULT 0 COMMENT '0未激活 1正常 2禁用',
  `headimgurl` varchar(255) DEFAULT NULL COMMENT '头像',
  `sex` int(11) DEFAULT 0 COMMENT '0未知 1男 2女',
  `remarks` varchar(30) DEFAULT NULL COMMENT '备注',
  `client_host` varchar(19) DEFAULT NULL COMMENT '访问IP',
  `create_time` datetime(6) NOT NULL DEFAULT current_timestamp(6) COMMENT '创建时间',
  `update_time` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='用户';

-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` VALUES (1, NULL, 1, '$pbkdf2-sha256$29000$a41RKuWc0/p/r1Wq9b73ng$ATzQaa36.Uq9dqYh6o8c2I/xjy7JpIoPba089.AkBj4', '阑羹阁兒', '17784891768', NULL, NULL, 1, NULL, 0, NULL, '192.168.3.101', '2021-04-14 13:46:17.162692', '2021-04-15 16:25:17.822819');
COMMIT;

-- ----------------------------
-- Table structure for user_role
-- ----------------------------
DROP TABLE IF EXISTS `user_role`;
CREATE TABLE `user_role` (
  `user_id` int(11) NOT NULL,
  `role_id` int(11) NOT NULL,
  KEY `user_id` (`user_id`),
  KEY `role_id` (`role_id`),
  CONSTRAINT `user_role_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_role_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for wechat
-- ----------------------------
DROP TABLE IF EXISTS `wechat`;
CREATE TABLE `wechat` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `city` varchar(255) DEFAULT NULL COMMENT '城市',
  `country` varchar(255) DEFAULT NULL COMMENT '国家',
  `headimgurl` varchar(255) DEFAULT NULL COMMENT '微信头像',
  `nickname` varchar(255) DEFAULT NULL COMMENT '微信昵称',
  `openid` varchar(255) DEFAULT NULL COMMENT 'openid',
  `province` varchar(255) DEFAULT NULL COMMENT '省份',
  `sex` int(11) DEFAULT NULL COMMENT '性别',
  `create_time` datetime(6) NOT NULL DEFAULT current_timestamp(6) COMMENT '创建时间',
  `update_time` datetime(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) COMMENT '更新时间',
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_wechat_user_43f94acc` (`user_id`),
  CONSTRAINT `fk_wechat_user_43f94acc` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='用户微信';

-- ----------------------------
-- Records of wechat
-- ----------------------------
BEGIN;
INSERT INTO `wechat` VALUES (1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2021-04-14 13:46:17.172350', '2021-04-14 13:46:17.172398', 1);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
